﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace ProjectEdificio
{
    /// <summary>
    /// Lógica de interacción para SendDatos.xaml
    /// </summary>
    public partial class SendDatos : Window
    {
        private SendEmail send = null;
        private BDManagment bdm = null;
        private Dictionary<String, Usuario> emails = null;

        public SendDatos()
        {
            InitializeComponent();
            bdm = BDManagment.getInstance();
            send = new SendEmail();
            emails = bdm.getListEmails();
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            if (emails.ContainsKey(textBoxEmail.Text))
            {
                send.SendEmailConDatos(emails[textBoxEmail.Text]);
                MessageBox.Show("Se ha enviado con exito sus datos a su email!");
                this.Close();
            }
            else
            {
                MessageBox.Show("No existe un usuario con ese email");
            }
        }

        private void button2_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }
    }
}
